<?php
# RATS unittest runner.
# Copyright (C) 2008 rambla.be
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# credentials and other data dependant of Svr location
# --------------------------------------------------
# !!!!!!!!!!!!!!! EDIT THESE BEFORE RUNNING TESTS !!!!!!!!!!!!
define('SUPERUSER', 'xxx');
define('SUPERPWD', 'xxx');
define('BASE', 'http://rats.enc01.rambla.be/');
define('NORMAL_USER', 'xxx');
define('NORMAL_PWD', 'xxx');
define('HIDDEN_FILE', '.xxx');
define('USER', '');
define('PWD', '');
define('EMAIL', '');
# local resources
define('LOCAL_SRC_FILE', '../test_resources/bla.mp4');
define('LOCAL_OVERLAY_FILE', '../test_resources/rambla.png');

# testdata (independant of Svr location)
# --------------------------------------
# general profile params
define('METHOD_RASS', 'rass');
define('METHOD_FTP', 'ftp');
define('CDN01', 'cdn01.rambla.be');
define('DESCRIPTION', 'my description');
define('BASE_URI', "ftp://myfileserver.glugle.org/fawlty/");
define('PUBLIC_URI', "http://publicserver.glugle.com/wadde/");

# input specific
define('INPUT_RASS', 'test_input_rass');
define('INPUT_FTP', 'test_input_ftp');
# output specific
define('OUTPUT_RASS', 'test_output_rass');
define('OUTPUT_FTP', 'test_output_ftp');
# format specific
define('FORMAT_MP4', 'test_format_mp4');
define('CONTAINER_MP4', 'mp4');
define('CATEGORY_FORMATS', 'formats');
# src specific
define('SRC_FILENAME', 'test_one_srcfile.mp4');
define('SRC_FILENAME2', 'test_two_srcfile.mp4');
# overlay specific
define('OVERLAY_FILENAME', 'test_one_overlayfile.mp4');
define('OVERLAY_FILENAME2', 'test_two_overlayfile.mp4');


# unittest set-up
# --------------------------------------

if (! defined('SIMPLE_TEST')) {
    define('SIMPLE_TEST', 'simpletest/');
}
require_once(SIMPLE_TEST . 'unit_tester.php');
require_once(SIMPLE_TEST . 'reporter.php');

require_once '../RawsClient/Raws.php';
require_once '../RawsClient/Raws/Rats.php';

$test = &new GroupTest('All tests');

if (! defined('UNIT_TESTS')) {
    define('UNIT_TESTS', 'rats_unittests/');
}
require_once(UNIT_TESTS . 'util.php');

$test = &new GroupTest('All tests');

deleteTestUser();

require_once(UNIT_TESTS . 'rats_src_test.php');
$test->addTestCase(new RatsSrcTest());
require_once(UNIT_TESTS . 'rats_overlay_test.php');
$test->addTestCase(new RatsOverlayTest());
require_once(UNIT_TESTS . 'rats_input_test.php');
$test->addTestCase(new RatsInputTest());
require_once(UNIT_TESTS . 'rats_output_test.php');
$test->addTestCase(new RatsOutputTest());
require_once(UNIT_TESTS . 'rats_format_test.php');
$test->addTestCase(new RatsFormatTest());

createTestUser();

$test->run(new HtmlReporter());